
/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  June 28th 2009 6:30:07 PM PDT                                */
/*      Machine:  10.16.140.107                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/bd92cz7b1og0kkss.pkg.js h:bat6l02s                        */
/*       Locale:  en_US                                                        */
/*         Path:  js/bd92cz7b1og0kkss.pkg.js                                   */
function UISelectList() {
	this._callback = bagofholding;
	this.container = $N("div", {className:"UISelectList clearfix"});
	this._mode = UISelectList.MULTI_SELECT_MODE;
	this._inputName = "UISelectList_name_" + gen_unique();
	this._items = {};
}
copy_properties(UISelectList, {MULTI_SELECT_MODE:1, SINGLE_SELECT_MODE:2, MULTI_SELECT_MODE_CHECKED_CLASS_NAME:"UISelectList_check_Checked", SINGLE_SELECT_MODE_CHECKED_CLASS_NAME:"UISelectList_radio_Checked"});
UISelectList.prototype = {setMode:function (mode) {
	if (mode != UISelectList.MULTI_SELECT_MODE && mode != UISelectList.SINGLE_SELECT_MODE) {
		Util.error("invalid mode %s passed to UISelectList.selectMode", mode);
		return this;
	}
	if (!is_empty(this._items)) {
		Util.error("You have to set `mode' before adding any items to " + "UISelectList");
		return this;
	}
	this._mode = mode;
	return this;
}, setCallback:function (fn) {
	this._callback = fn;
	return this;
}, addItem:function (label, checked, key) {
	var item = {label:label, checked:checked, key:key};
	this._renderItem(item);
	return this;
}, addItems:function (items) {
	for (var i = 0; i < items.length; i++) {
		this.addItem(items[i].label, items[i].checked, items[i].key);
	}
	return this;
}, clearItems:function () {
	this._items = {};
	DOM.empty(this.container);
	return this;
}, setSelected:function (key, selected) {
	if (this._items[key]) {
		var input = this._items[key].input;
		input.checked = !selected;
		input.click();
	}
	return this;
}, getElement:function () {
	return this.container;
}, reset:function () {
	for (var key in this._items) {
		var input = this._items[key].input;
		var label = this._items[key].label;
		input.checked = input.defaultChecked;
		CSS.conditionClass(label, this._getCheckedClass(), input.checked);
	}
}, _renderItem:function (item) {
	var input = $N("input", {type:this._getInputType(), name:this._inputName});
	input.checked = item.checked;
	input.defaultChecked = item.checked;
	var link = $N("a", {className:"UISelectList_Label", href:"#"}, item.label);
	if (item.checked) {
		link.addClass(this._getCheckedClass());
	}
	link.listen("click", Event.kill);
	link.listen("mouseup", this._linkClicked.bind(this, input));
	input.listen("click", this._clicked.bind(this, input, link, item.key));
	this.container.appendContent($N("div", {className:"UISelectList_Item"}, [input, link]));
	item.input = input;
	item.label = link;
	this._items[item.key] = item;
}, _getInputType:function () {
	if (this._mode == UISelectList.MULTI_SELECT_MODE) {
		return "checkbox";
	}
	return "radio";
}, _getCheckedClass:function () {
	if (this._mode == UISelectList.MULTI_SELECT_MODE) {
		return UISelectList.MULTI_SELECT_MODE_CHECKED_CLASS_NAME;
	}
	return UISelectList.SINGLE_SELECT_MODE_CHECKED_CLASS_NAME;
}, _linkClicked:function (input, e) {
	input.click();
}, _clicked:function (input, label, key, e) {
	var clickedElemChecked;
	if (this._mode == UISelectList.SINGLE_SELECT_MODE) {
		for (var k in this._items) {
			var checked = input == this._items[k].input;
			CSS.conditionClass(this._items[k].label, this._getCheckedClass(), checked);
		}
		clickedElemChecked = true;
	} else {
		clickedElemChecked = input.checked;
		CSS.conditionClass(label, this._getCheckedClass(), input.checked);
	}
	this._callback(clickedElemChecked, key);
	$E(e).stop();
}};
function Scroller(canvas) {
	this.canvas = canvas;
	this.scrollZone = 50;
	this.velocity = 100;
	this.coefficient = 1;
}
Scroller.findScrollParent = function (el) {
	var sty;
	el = el.parentNode;
	while (el) {
		if (el.scrollHeight != el.offsetTop) {
			sty = CSS.getStyle(el, "overflowY");
			if (sty == "scroll" || sty == "auto") {
				return el;
			}
		}
		el = el.parentNode;
	}
	return document.body;
};
Scroller.prototype.activate = function () {
	this.activate = bagofholding;
	this.event = $(document).listen("mousemove", this._onmousemove.bind(this));
	this.interval = this._intervalHandler.bind(this).recur(50);
	this.cursor = null;
};
Scroller.prototype.deactivate = function () {
	delete this.activate;
	this.event && this.event.remove();
	this.event = null;
	clearInterval(this.interval);
};
Scroller.prototype._onmousemove = function (event) {
	this.cursor = new Vector2.getEventPosition(event);
};
Scroller.prototype._intervalHandler = function () {
	if (!this.cursor) {
		return;
	}
	var viewport = this.canvas == document.body ? Rect.getViewportBounds() : Rect(this.canvas);
	var rect = new Rect(this.cursor.y - viewport.t, viewport.r - this.cursor.x, viewport.b - this.cursor.y, this.cursor.x - viewport.l);
	var scrollBy = new Vector2(0, 0);
	if (rect.t < rect.b && rect.t < this.scrollZone) {
		scrollBy.y = -this.scrollZone + rect.t;
	} else {
		if (rect.b < this.scrollZone) {
			scrollBy.y = this.scrollZone - rect.b;
		}
	}
	scrollBy.y = this._doMath(scrollBy.y);
	if (rect.l < rect.r && rect.l < this.scrollZone) {
		scrollBy.x = -this.scrollZone + rect.l;
	} else {
		if (rect.r < this.scrollZone) {
			scrollBy.x = this.scrollZone - rect.r;
		}
	}
	scrollBy.x = this._doMath(scrollBy.x);
	if (scrollBy.x || scrollBy.y) {
		scrollBy.scrollElementBy(this.canvas);
		if (document.body == this.canvas) {
			this.cursor = this.cursor.add(scrollBy);
		}
		Arbiter.inform("scroller/scroll", this.cursor);
	}
};
Scroller.prototype._doMath = function (diff) {
	return Math.floor(Math.pow((diff >= 0 ? Math.min(diff, this.scrollZone) : Math.max(diff, -this.scrollZone)) / this.scrollZone * this.velocity, this.coefficient));
};
var Drag = {};
Drag.currentDraggable = null;
Drag.grab = function (draggable) {
	if (Drag.currentDraggable) {
		Drag._onmouseup();
	}
	draggable.lastDragOver = null;
	Drag.attachDragEvents();
	Drag.currentDraggable = draggable;
};
Drag.attachDragEvents = function () {
	document.onselectstart = function () {
		document.onselectstart = null;
		return false;
	};
	if (Drag.dragEventsAttached) {
		return;
	}
	Drag.dragEventsAttached = true;
	Arbiter.subscribe("scroller/scroll", Drag._onmousemove);
	Event.listen(document, "mousemove", Drag._onmousemove);
	Event.listen(document, "mouseup", Drag._onmouseup);
};
Drag.droppables = {};
Drag.addDroppable = function (namespace, droppable) {
	(Drag.droppables[namespace] = Drag.droppables[namespace] || []).push(droppable);
};
Drag.removeDroppable = function (namespace, droppable) {
	Drag.droppables[namespace] = Drag.droppables[namespace].filter(function (a) {
		return a != droppable;
	});
};
Drag._onmousemove = function (event, cursor) {
	if (!Drag.currentDraggable) {
		return;
	}
	var cursorPosition = cursor || Vector2.getEventPosition(event), currentDraggable = Drag.currentDraggable, droppables = Drag.droppables[currentDraggable.namespace];
	if (currentDraggable.namespace && currentDraggable.active && droppables) {
		var zIndexesDict = {};
		droppables.each(function (droppable) {
			zIndexesDict[droppable.zIndex] = droppable.zIndex;
		});
		var zIndexes = [];
		for (var i in zIndexesDict) {
			zIndexes.push(zIndexesDict[i]);
		}
		zIndexes.sort();
		var lastDragOver = currentDraggable.lastDragOver, currentDragOver = null;
		for (var z = zIndexes.length; z >= 0; z--) {
			if (lastDragOver && lastDragOver.dom != null && lastDragOver.zIndex == zIndexes[z] && lastDragOver.pointInside(cursorPosition)) {
				currentDragOver = lastDragOver;
				break;
			} else {
				for (var i = 0; i < droppables.length; i++) {
					if (zIndexes[z] != droppables[i].zIndex) {
						continue;
					}
					if (lastDragOver != droppables[i] && currentDraggable.dom != droppables[i].dom && droppables[i].pointInside(cursorPosition)) {
						currentDragOver = droppables[i];
						z = -1;
						break;
					}
				}
			}
		}
		if (currentDragOver && currentDragOver != lastDragOver) {
			currentDragOver.ondragover(currentDraggable);
		}
		if (currentDragOver) {
			currentDragOver.ondragmove(currentDraggable, cursorPosition.sub(Vector2.getElementPosition(currentDragOver.dom)));
		}
		currentDraggable.lastDragOver = currentDragOver;
	}
	Drag.currentDraggable._onmousemove(cursorPosition);
};
Drag._onmouseup = function (e) {
	document.onselectstart = null;
	if (Drag.currentDraggable) {
		Drag.currentDraggable._ondrop();
		Drag.currentDraggable = null;
	}
};
function Draggable(element) {
	if (!element) {
		throw new Error("Element should be a DOM node");
	}
	if (this == window) {
		if (element instanceof Array) {
			var collection = [];
			element.each(function (instance) {
				collection.push(new Draggable(instance));
			});
			return new Collection(Draggable, collection);
		} else {
			return new Draggable(element);
		}
	} else {
		this.data = {};
		this.handles = [];
		this.dom = element;
		this.boundingBox = null;
		this.addHandle(this.dom);
	}
}
Draggable.prototype.destroy = function () {
	this.handles.each(function (handle) {
		this.removeHandle(handle.obj);
	}.bind(this));
	this.data = this.dom = null;
};
Draggable.prototype._onclick = function (event) {
	if (this.active) {
		return Event.kill(event);
	}
};
Draggable.prototype._ongrab = function (vector) {
	this.ongrab();
	if (!this.scroller) {
		this.scroller = new Scroller(Scroller.findScrollParent(this.dom));
	}
	this.scroller.activate();
	if (this.active) {
		if (!this.oldPosition) {
			this.oldPosition = this.dom.style.position;
		}
		this.dom.style.position = this.absolute ? "absolute" : "relative";
		vector.sub(this.cursorPositionVector).setElementPosition(this.dom);
	}
};
Draggable.prototype._onmousedown = function (event) {
	var target = $E(event).getTarget();
	if (DOM.isNode(target, ["input", "select", "textarea", "object", "embed"])) {
		return true;
	}
	var vector = Vector2.getEventPosition(event);
	this.draggableInitialVector = Vector2.getElementPosition(this.dom);
	this.cursorPositionVector = vector.sub(this.draggableInitialVector);
	Drag.grab(this, event);
	if (this.gutter) {
		this.cursorInitialVector = vector;
	} else {
		this._setActive(true);
		this._ongrab(vector);
	}
	return Event.kill(event);
};
Draggable.prototype._onmousemove = function (vector) {
	if (!this.active) {
		if (vector.distanceTo(this.cursorInitialVector) >= this.gutter) {
			this._setActive(true);
			this._ongrab(vector);
		}
	}
	if (this.active) {
		var sub_vector = Vector2.getElementPosition(this.dom).sub(new Vector2(parseInt(this.dom.style.left ? this.dom.style.left : CSS.getStyle(this.dom, "left"), 10) || 0, parseInt(this.dom.style.top ? this.dom.style.top : CSS.getStyle(this.dom, "top"), 10) || 0));
		var vector2 = vector.sub(sub_vector).sub(this.cursorPositionVector);
		if (this.boundingBox) {
			var box = Rect.newFromVectors(vector2, Vector2.getElementDimensions(this.dom));
			box = box.boundWithin(this.boundingBox);
			vector2 = box.getPositionVector(box);
			if (this.boundingBox.w() == 0) {
				var final_vector = new Vector2(this.draggableInitialVector.x, vector2.y, "document");
			} else {
				if (this.boundingBox.h() == 0) {
					var final_vector = new Vector2(vector2.x, this.draggableInitialVector.y, "document");
				} else {
					var final_vector = vector2;
				}
			}
		} else {
			var final_vector = vector2;
		}
		final_vector.setElementPosition(this.dom);
		this.ondrag(vector);
	}
};
Draggable.prototype._ondrop = function () {
	this.scroller && this.scroller.deactivate();
	if (this.active) {
		(function () {
			this._setActive(false);
		}).bind(this).defer();
		this.ondrop();
		if (this.lastDragOver) {
			this.lastDragOver.ondrop(this);
		}
	}
};
Draggable.prototype.killDrag = function () {
	this._setActive(false);
	Drag._onmouseup();
};
Draggable.prototype.setBoundingBox = function (bounding_box) {
	this.boundingBox = bounding_box;
	return this;
};
Draggable.prototype.resetPosition = function () {
	this.dom.style.position = this.oldPosition;
	this.oldPosition = null;
	this.dom.style.left = null;
	this.dom.style.top = null;
	return this;
};
Draggable.prototype.setUseAbsolute = function (absolute) {
	this.absolute = absolute;
	return this;
};
Draggable.prototype.ondrag = bagofholding;
Draggable.prototype.setDragHandler = function (func) {
	this.ondrag = func;
	return this;
};
Draggable.prototype.ongrab = bagofholding;
Draggable.prototype.setGrabHandler = function (func) {
	this.ongrab = func;
	return this;
};
Draggable.prototype.ondrop = bagofholding;
Draggable.prototype.setDropHandler = function (func) {
	this.ondrop = func;
	return this;
};
Draggable.prototype.gutter = 0;
Draggable.prototype.setGutter = function (gutter) {
	this.gutter = gutter;
	return this;
};
Draggable.prototype.setNamespace = function (namespace) {
	this.namespace = namespace;
	return this;
};
Draggable.prototype.handles = null;
Draggable.prototype.addHandle = function (handle) {
	if (this.handles.length == 1 && this.handles[0].obj == this.dom) {
		this.removeHandle(this.dom);
	}
	this.handles.push({obj:handle, evt:[Event.listen(handle, "mousedown", this._onmousedown.bind(this)), Event.listen(handle, "click", this._onclick.bind(this)), Event.listen(handle, "drag", Event.kill), Event.listen(handle, "selectstart", Event.kill)]});
	return this;
};
Draggable.prototype.removeHandle = function (handle) {
	this.handles = this.handles.filter(function (a) {
		if (a.obj != handle) {
			return true;
		} else {
			a.evt.each(function (evt) {
				evt.remove();
			});
			return false;
		}
	});
};
Draggable.prototype.getDOM = function () {
	return this.dom;
};
Draggable.prototype.setKey = function (key, value) {
	this.data[key] = value;
	return this;
};
Draggable.prototype.getKey = function (key) {
	return this.data[key];
};
Draggable.prototype._setActive = function (state) {
	this.dom.activeDrag = this.active = state;
	for (var i = 0; i < this.handles.length; i++) {
		this.handles[i].obj.activeDrag = state;
	}
};
function Droppable(element) {
	if (!element) {
		throw new Error("Element should be a DOM node");
	}
	if (this == window) {
		if (element instanceof Array) {
			var collection = [];
			element.each(function (instance) {
				collection.push(new Droppable(instance));
			});
			return new Collection(Droppable, collection);
		} else {
			return new Droppable(element);
		}
	} else {
		this.data = {};
		this.dom = element;
		this.namespace = null;
	}
}
Droppable.prototype.destroy = function () {
	if (this.namespace) {
		Drag.removeDroppable(this.namespace, this);
	}
	this.data = this.dom = null;
};
Droppable.prototype.setNamespace = function (namespace) {
	if (this.namespace) {
		Drag.removeDroppable(namespace, this);
	}
	this.namespace = namespace;
	Drag.addDroppable(namespace, this);
	return this;
};
Droppable.prototype.zIndex = 0;
Droppable.prototype.setZIndex = function (index) {
	this.zIndex = index;
	return this;
};
Droppable.prototype.pointInside = function (vector) {
	var position = Vector2.getElementPosition(this.dom);
	return position.x <= vector.x && this.dom.offsetWidth + position.x > vector.x && position.y <= vector.y && this.dom.offsetHeight + position.y > vector.y;
};
Droppable.prototype.ondragover = bagofholding;
Droppable.prototype.setDragOverHandler = function (func) {
	this.ondragover = func;
	return this;
};
Droppable.prototype.ondragmove = bagofholding;
Droppable.prototype.setDragMoveHandler = function (func) {
	this.ondragmove = func;
	return this;
};
Droppable.prototype.ondrop = bagofholding;
Droppable.prototype.setDropHandler = function (func) {
	this.ondrop = func;
	return this;
};
Droppable.prototype.getDOM = Draggable.prototype.getDOM;
Droppable.prototype.setKey = Draggable.prototype.setKey;
Droppable.prototype.getKey = Draggable.prototype.getKey;
function SortableGroup() {
	this.namespace = "sortable" + (++SortableGroup.instanceCount);
	this.draggables = {};
	this.droppables = {};
	this.sortables = {};
	this.linkedGroups = [];
	this.linkedGroups.onlinkjump = bagofholding;
	this.rootNode = null;
	this.boundingBox = null;
	this.neverEmpty = false;
	this.hasEmptyMessage = false;
	this.isDroppable = true;
	this.anchor = null;
}
SortableGroup.instanceCount = 0;
SortableGroup.prototype.gutter = 15;
SortableGroup.prototype.setBoundingBox = function (bounding_box) {
	this.boundingBox = bounding_box;
	for (var k in this.draggables) {
		this.draggables[k].setBoundingBox(this.boundingBox);
	}
	return this;
};
SortableGroup.prototype.setDroppable = function (val) {
	this.isDroppable = val;
	return this;
};
SortableGroup.prototype._initializeAdded = function (key, obj) {
	if (this.rootNode === null) {
		this.rootNode = obj.parentNode;
		if (!this.linkedGroups.placeholder) {
			this.linkedGroups.placeholder = this.placeholder = $N(obj.tagName, {className:"dragPlaceholder", style:{padding:"0px"}});
		} else {
			this.placeholder = this.linkedGroups.placeholder;
		}
	} else {
		if (this.rootNode != obj.parentNode) {
			throw new Error("All sortables of a collection must share the same parentNode");
		}
	}
	if (key in this.draggables) {
		throw new Error("All sortables must have a unique key");
	}
};
SortableGroup.prototype.addSortable = function (key, obj, handle) {
	this._initializeAdded(key, obj);
	this.sortables[key] = obj;
	this.draggables[key] = (new Draggable(obj)).setNamespace(this.namespace).setGutter(this.gutter).setUseAbsolute(true).setGrabHandler(this.grabHandler.bind(this, key)).setDropHandler(this.dropHandler.bind(this, key)).setKey("key", key).setBoundingBox(this.boundingBox);
	if (handle) {
		this.draggables[key].addHandle(handle);
	}
	this.droppables[key] = (new Droppable(obj)).setNamespace(this.namespace).setDragOverHandler(this._dragOverHandlerShim.bind(null, this, key));
	return this;
};
SortableGroup.prototype.addEmptyMessage = function (obj, root) {
	var key = "placeholder";
	if (obj.parentNode != root) {
		root.appendContent(obj);
	}
	this._initializeAdded(key, obj);
	this.hasEmptyMessage = true;
	this.sortables[key] = obj;
	this.droppables[key] = (new Droppable(obj)).setNamespace(this.namespace).setDragOverHandler(this._dragOverHandlerShim.bind(null, this, key));
	return this;
};
SortableGroup.prototype.setNeverEmpty = function (neverEmpty) {
	this.neverEmpty = neverEmpty;
};
SortableGroup.prototype.link = function (sortgroup) {
	sortgroup.linkedGroups = this.linkedGroups;
	if (!this.linkedGroups.length) {
		this.linkedGroups.push(this);
	}
	this.linkedGroups.push(sortgroup);
	for (var i = 0; i < this.linkedGroups.length; i++) {
		if (this.linkedGroups[i].namespace != this.namespace) {
			this.linkedGroups[i].namespace = this.namespace;
			for (var j in this.linkedGroups[i].droppables) {
				this.linkedGroups[i].droppables[j].setNamespace(this.namespace);
				this.linkedGroups[i].draggables[j].setNamespace(this.namespace);
			}
		}
	}
	return this;
};
SortableGroup.prototype.getOrder = function () {
	if (!this.rootNode) {
		return [];
	}
	var ret = [], childNodes = this.rootNode.childNodes;
	for (var i = 0; i < childNodes.length; i++) {
		for (var k in this.sortables) {
			if (this.sortables[k] == childNodes[i]) {
				ret.push(k);
				break;
			}
		}
	}
	return ret;
};
SortableGroup.prototype.migrateLinkedSortable = function (key) {
	for (var i = 0; i < this.linkedGroups.length; i++) {
		if (key in this.linkedGroups[i].draggables) {
			this.sortables[key] = this.linkedGroups[i].sortables[key];
			this.draggables[key] = this.linkedGroups[i].draggables[key];
			this.draggables[key].setGrabHandler(this.grabHandler.bind(this, key)).setDropHandler(this.dropHandler.bind(this, key));
			this.droppables[key] = this.linkedGroups[i].droppables[key];
			this.droppables[key].setDragOverHandler(this._dragOverHandlerShim.bind(null, this, key));
			delete this.linkedGroups[i].sortables[key];
			delete this.linkedGroups[i].draggables[key];
			delete this.linkedGroups[i].droppables[key];
			return true;
		}
	}
	return false;
};
SortableGroup.prototype.setLinkJumpHandler = function (func) {
	this.linkedGroups.onlinkjump = func;
	return this;
};
SortableGroup.prototype.onorderchange = bagofholding;
SortableGroup.prototype.setOrderChangeHandler = function (func) {
	this.onorderchange = func;
	return this;
};
SortableGroup.prototype.ongrabcallback = bagofholding;
SortableGroup.prototype.setGrabCallback = function (func) {
	this.ongrabcallback = func;
	return this;
};
SortableGroup.prototype._checkLastRemaining = function (draggable) {
	var oneNodeLeft = this.hasEmptyMessage ? 2 : 1;
	return this.neverEmpty && this.rootNode.childNodes.length == oneNodeLeft;
};
SortableGroup.prototype.grabHandler = function (draggableKey) {
	if (this._checkLastRemaining()) {
		this.draggables[draggableKey].killDrag();
		return;
	}
	CSS.setClass(this.placeholder, this.sortables[draggableKey].className);
	CSS.addClass(this.placeholder, "droppable_placeholder");
	CSS.addClass(this.sortables[draggableKey], "drag");
	Vector2.getElementDimensions(this.sortables[draggableKey]).setElementDimensions(this.placeholder);
	this.rootNode.insertBefore(this.placeholder, this.sortables[draggableKey]);
	this.ongrabcallback(draggableKey);
	if (!this.isDroppable) {
		var sortable = this.sortables[draggableKey];
		this.anchor = sortable.nextSibling;
		if (!this.anchor) {
			this.anchor = $N("div");
			sortable.parentNode.appendChild(this.anchor);
		}
	}
};
SortableGroup.prototype.ondropcallback = bagofholding;
SortableGroup.prototype.setDropCallback = function (func) {
	this.ondropcallback = func;
	return this;
};
SortableGroup.prototype.dropHandler = function (draggableKey) {
	if (this._checkLastRemaining()) {
		this.draggables[draggableKey].resetPosition();
		return;
	}
	CSS.removeClass(this.sortables[draggableKey], "drag");
	this.draggables[draggableKey].resetPosition();
	this.rootNode.insertBefore(this.sortables[draggableKey], this.placeholder);
	this.rootNode.removeChild(this.placeholder);
	for (var i = 0; i < this.linkedGroups.length; i++) {
		if (this.linkedGroups[i].anchor) {
			delete this.linkedGroups[i].anchor;
		}
	}
	this.ondropcallback(draggableKey);
	this.onorderchange();
};
SortableGroup.prototype._dragOverHandlerShim = function (that, droppableKey, draggable) {
	that.dragOverHandler(droppableKey, draggable.getKey("key"));
};
SortableGroup.prototype.dragOverHandler = function (droppableKey, draggableKey) {
	if (!this.isDroppable && !this.anchor) {
		return;
	}
	var jumped = false;
	if (!(draggableKey in this.draggables)) {
		if (!this.migrateLinkedSortable(draggableKey)) {
			throw new Error("Draggable dropped onto a foreign droppable!");
		}
		jumped = true;
	}
	var before = true, childNodes = this.rootNode.childNodes, draggable = this.sortables[draggableKey], droppable = this.sortables[droppableKey];
	if (!this.anchor) {
		for (var i = 0; i < childNodes.length; i++) {
			if (childNodes[i] == droppable) {
				break;
			} else {
				if (childNodes[i] == draggable) {
					before = false;
					break;
				}
			}
		}
	} else {
		droppable = this.anchor;
	}
	if (before || this.anchor) {
		this.rootNode.insertBefore(this.placeholder, droppable);
	} else {
		this.rootNode.insertBefore(this.placeholder, droppable.nextSibling);
	}
	this.rootNode.insertBefore(draggable, this.placeholder);
	this.ondragover(draggable, droppable);
	if (jumped) {
		this.linkedGroups.onlinkjump.call(this, draggableKey);
	}
};
SortableGroup.prototype.ondragover = bagofholding;
SortableGroup.prototype.setDragOverCallback = function (func) {
	this.ondragover = func;
	return this;
};
SortableGroup.prototype.destroy = function () {
	for (var k in this.droppables) {
		this.droppables[k].destroy();
	}
	for (var k in this.draggables) {
		this.draggables[k].destroy();
	}
	this.droppables = this.draggables = this.rootNode = null;
	this.linkedGroups.remove(this);
	for (var i = 0; i < this.linkedGroups.length; i++) {
		this.linkedGroups[i].linkedGroups = this.linkedGroups;
	}
};
SortableGroup.prototype.removeSortable = function (key) {
	if (key in this.sortables) {
		this.draggables[key].destroy();
		this.droppables[key].destroy();
		delete this.draggables[key];
		delete this.droppables[key];
		delete this.sortables[key];
	}
};
SortableGroup.prototype.keyExists = function (key) {
	return this.sortables[key];
};
function typeahead_source() {
}
typeahead_source.prototype.cache_results = false;
typeahead_source.prototype.enumerable = false;
typeahead_source.prototype.allow_fake_results = false;
typeahead_source.prototype.search_limit = 10;
typeahead_source.prototype.bootstrap = bagofholding;
typeahead_source.check_match = function (search, value) {
	value = typeahead_source.tokenize(value);
	for (var i = 0, il = search.length; i < il; i++) {
		if (search[i].length) {
			var found = false;
			for (var j = 0, jl = value.length; j < jl; j++) {
				if (value[j].length >= search[i].length && value[j].substring(0, search[i].length) == search[i]) {
					found = true;
					value[j] = "";
					break;
				}
			}
			if (!found) {
				return false;
			}
		}
	}
	return true;
};
typeahead_source.tokenize = function (text, capture, noflatten) {
	return (noflatten ? text : typeahead_source.flatten_string(text)).split(capture ? typeahead_source.normalizer_regex_capture : typeahead_source.normalizer_regex);
};
typeahead_source.normalizer_regex_str = "(?:(?:^| +)[\"'.\\-]+ *)|(?: *['\".\\-]+(?: +|$)|[@_]| +)";
typeahead_source.normalizer_regex = new RegExp(typeahead_source.normalizer_regex_str, "g");
typeahead_source.normalizer_regex_capture = new RegExp("(" + typeahead_source.normalizer_regex_str + ")", "g");
typeahead_source.flatten_string = function (text) {
	if (!typeahead_source.accents) {
		typeahead_source.accents = {a:/\u0430|\u00e0|\u00e1|\u00e2|\u00e3|\u00e4|\u00e5/g, b:/\u0431/g, c:/\u0446|\u00e7/g, d:/\u0434|\u00f0/g, e:/\u044d|\u0435|\u00e8|\u00e9|\u00ea|\u00eb/g, f:/\u0444/g, g:/\u0433/g, h:/\u0445/g, i:/\u0438|\u00ec|\u00ed|\u00ee|\u00ef/g, j:/\u0439/g, k:/\u043a/g, l:/\u043b/g, m:/\u043c/g, n:/\u043d|\u00f1/g, o:/\u043e|\u00f8|\u00f6|\u00f5|\u00f4|\u00f3|\u00f2/g, p:/\u043f/g, r:/\u0440/g, s:/\u0441/g, t:/\u0442/g, u:/\u0443|\u044e|\u00fc|\u00fb|\u00fa|\u00f9/g, v:/\u0432/g, y:/\u044b|\u00ff|\u00fd/g, z:/\u0437/g, ae:/\u00e6/g, oe:/\u0153/g, ts:/\u0446/g, ch:/\u0447/g, sh:/\u0448/g, ya:/\u044f/g};
	}
	text = text.toLowerCase();
	for (var i in typeahead_source.accents) {
		text = text.replace(typeahead_source.accents[i], i);
	}
	return text;
};
typeahead_source.prototype.set_owner = function (obj) {
	this.owner = obj;
	if (this.is_ready) {
		this.owner.update_status(typeaheadpro.STATUS_IDLE);
	}
};
typeahead_source.prototype.ready = function () {
	if (this.owner && !this.is_ready) {
		this.is_ready = true;
		this.owner.update_status(typeaheadpro.STATUS_IDLE);
	} else {
		this.is_ready = true;
	}
};
typeahead_source.highlight_found = function (result, search) {
	var html = [];
	resultv = typeahead_source.tokenize(result, true, true);
	result = typeahead_source.tokenize(result, true);
	search = typeahead_source.tokenize(search);
	search.sort(typeahead_source._sort);
	for (var i = 0, il = resultv.length; i < il; i++) {
		var found = false;
		for (var j = 0, jl = search.length; j < jl; j++) {
			if (search[j] && result[i].lastIndexOf(search[j], 0) != -1) {
				html.push("<em>", htmlspecialchars(resultv[i].substring(0, search[j].length)), "</em>", htmlspecialchars(resultv[i].substring(search[j].length, resultv[i].length)));
				found = true;
				break;
			}
		}
		if (!found) {
			html.push(htmlspecialchars(resultv[i]));
		}
	}
	return html.join("");
};
typeahead_source._sort = function (a, b) {
	return b.length - a.length;
};
typeahead_source.prototype.gen_nomatch = function () {
	return this.text_nomatch != null ? this.text_nomatch : _tx("No matches found");
};
typeahead_source.prototype.gen_loading = function () {
	return this.text_loading != null ? this.text_loading : _tx("Loading...");
};
typeahead_source.prototype.gen_placeholder = function () {
	return this.text_placeholder != null ? this.text_placeholder : _tx("Start typing...");
};
typeahead_source.prototype.gen_noinput = function () {
	return this.text_noinput != null ? this.text_noinput : _tx("Start typing...");
};
typeahead_source.prototype.onselect_not_found = function () {
	if (typeof this.tokenizer._ontokennotfound != "undefined") {
		this.tokenizer._ontokennotfound(this.obj.value);
	}
	if (typeof this.tokenizer.onselect != "undefined") {
		return this.tokenizer.onselect();
	}
};
function static_source() {
	this.values = null;
	this.index = null;
	this.index_includes_hints = false;
	this.exclude_ids = {};
	this.parent.construct(this);
}
static_source.extend("typeahead_source");
static_source.prototype.enumerable = true;
static_source.prototype.filter_excluded = function (values) {
	return values.filter((function (value) {
		return !this.exclude_ids[value.i];
	}).bind(this));
};
static_source.prototype.build_index = function () {
	var index = [];
	var values = this.values;
	var gen_id = values.length && typeof values[0].i == "undefined";
	for (var i = 0, il = values.length; i < il; i++) {
		var tokens = typeahead_source.tokenize(values[i].t);
		for (var j = 0, jl = tokens.length; j < jl; j++) {
			index.push({t:tokens[j], o:values[i]});
		}
		if (this.index_includes_hints && values[i].s) {
			var tokens = typeahead_source.tokenize(values[i].s);
			for (var j = 0, jl = tokens.length; j < jl; j++) {
				index.push({t:tokens[j], o:values[i]});
			}
		}
		if (gen_id) {
			values[i].i = i;
		}
	}
	index.sort(function (a, b) {
		return (a.t == b.t) ? 0 : (a.t < b.t ? -1 : 1);
	});
	this.index = index;
	this.ready();
};
static_source.prototype._sort_text_obj = function (a, b) {
	if (a.e && !b.e) {
		return 1;
	}
	if (!a.e && b.e) {
		return -1;
	}
	return a.t.localeCompare(b.t);
};
static_source.prototype.search_value = function (text) {
	if (!this.is_ready) {
		return;
	}
	var results;
	if (text == "") {
		results = this.values;
	} else {
		var ttext = typeahead_source.tokenize(text).sort(typeahead_source._sort);
		var index = this.index;
		var lo = 0;
		var hi = this.index.length - 1;
		var p = Math.floor(hi / 2);
		while (lo <= hi) {
			if (index[p].t >= ttext[0]) {
				hi = p - 1;
			} else {
				lo = p + 1;
			}
			p = Math.floor(lo + ((hi - lo) / 2));
		}
		var results = [];
		var stale_keys = {};
		var check_ignore = typeof _ignoreList != "undefined";
		for (var i = lo; i < index.length && index[i].t.lastIndexOf(ttext[0], 0) != -1; i++) {
			var elem_id = index[i].o.flid ? index[i].o.flid : index[i].o.i;
			if (typeof stale_keys[elem_id] != "undefined") {
				continue;
			} else {
				stale_keys[elem_id] = true;
			}
			if ((!check_ignore || !_ignoreList[elem_id]) && !this.exclude_ids[elem_id] && (ttext.length == 1 || typeahead_source.check_match(ttext, index[i].o.t))) {
				results.push(index[i].o);
			}
		}
	}
	results.sort(this._sort_text_obj.bind(this));
	if (this.owner && this.owner.max_results) {
		results = results.slice(0, this.owner.max_results);
	}
	return results;
};
static_source.prototype.set_exclude_ids = function (ids) {
	this.exclude_ids = ids;
};
var hex_chr = "0123456789abcdef";
function rhex(num) {
	str = "";
	for (j = 0; j <= 3; j++) {
		str += hex_chr.charAt((num >> (j * 8 + 4)) & 15) + hex_chr.charAt((num >> (j * 8)) & 15);
	}
	return str;
}
function str2blks_MD5(str) {
	nblk = ((str.length + 8) >> 6) + 1;
	blks = new Array(nblk * 16);
	for (i = 0; i < nblk * 16; i++) {
		blks[i] = 0;
	}
	for (i = 0; i < str.length; i++) {
		blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);
	}
	blks[i >> 2] |= 128 << ((i % 4) * 8);
	blks[nblk * 16 - 2] = str.length * 8;
	return blks;
}
function add(x, y) {
	var lsw = (x & 65535) + (y & 65535);
	var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
	return (msw << 16) | (lsw & 65535);
}
function rol(num, cnt) {
	return (num << cnt) | (num >>> (32 - cnt));
}
function cmn(q, a, b, x, s, t) {
	return add(rol(add(add(a, q), add(x, t)), s), b);
}
function ff(a, b, c, d, x, s, t) {
	return cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function gg(a, b, c, d, x, s, t) {
	return cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function hh(a, b, c, d, x, s, t) {
	return cmn(b ^ c ^ d, a, b, x, s, t);
}
function ii(a, b, c, d, x, s, t) {
	return cmn(c ^ (b | (~d)), a, b, x, s, t);
}
function MD5(str) {
	x = str2blks_MD5(str);
	var a = 1732584193;
	var b = -271733879;
	var c = -1732584194;
	var d = 271733878;
	for (i = 0; i < x.length; i += 16) {
		var olda = a;
		var oldb = b;
		var oldc = c;
		var oldd = d;
		a = ff(a, b, c, d, x[i + 0], 7, -680876936);
		d = ff(d, a, b, c, x[i + 1], 12, -389564586);
		c = ff(c, d, a, b, x[i + 2], 17, 606105819);
		b = ff(b, c, d, a, x[i + 3], 22, -1044525330);
		a = ff(a, b, c, d, x[i + 4], 7, -176418897);
		d = ff(d, a, b, c, x[i + 5], 12, 1200080426);
		c = ff(c, d, a, b, x[i + 6], 17, -1473231341);
		b = ff(b, c, d, a, x[i + 7], 22, -45705983);
		a = ff(a, b, c, d, x[i + 8], 7, 1770035416);
		d = ff(d, a, b, c, x[i + 9], 12, -1958414417);
		c = ff(c, d, a, b, x[i + 10], 17, -42063);
		b = ff(b, c, d, a, x[i + 11], 22, -1990404162);
		a = ff(a, b, c, d, x[i + 12], 7, 1804603682);
		d = ff(d, a, b, c, x[i + 13], 12, -40341101);
		c = ff(c, d, a, b, x[i + 14], 17, -1502002290);
		b = ff(b, c, d, a, x[i + 15], 22, 1236535329);
		a = gg(a, b, c, d, x[i + 1], 5, -165796510);
		d = gg(d, a, b, c, x[i + 6], 9, -1069501632);
		c = gg(c, d, a, b, x[i + 11], 14, 643717713);
		b = gg(b, c, d, a, x[i + 0], 20, -373897302);
		a = gg(a, b, c, d, x[i + 5], 5, -701558691);
		d = gg(d, a, b, c, x[i + 10], 9, 38016083);
		c = gg(c, d, a, b, x[i + 15], 14, -660478335);
		b = gg(b, c, d, a, x[i + 4], 20, -405537848);
		a = gg(a, b, c, d, x[i + 9], 5, 568446438);
		d = gg(d, a, b, c, x[i + 14], 9, -1019803690);
		c = gg(c, d, a, b, x[i + 3], 14, -187363961);
		b = gg(b, c, d, a, x[i + 8], 20, 1163531501);
		a = gg(a, b, c, d, x[i + 13], 5, -1444681467);
		d = gg(d, a, b, c, x[i + 2], 9, -51403784);
		c = gg(c, d, a, b, x[i + 7], 14, 1735328473);
		b = gg(b, c, d, a, x[i + 12], 20, -1926607734);
		a = hh(a, b, c, d, x[i + 5], 4, -378558);
		d = hh(d, a, b, c, x[i + 8], 11, -2022574463);
		c = hh(c, d, a, b, x[i + 11], 16, 1839030562);
		b = hh(b, c, d, a, x[i + 14], 23, -35309556);
		a = hh(a, b, c, d, x[i + 1], 4, -1530992060);
		d = hh(d, a, b, c, x[i + 4], 11, 1272893353);
		c = hh(c, d, a, b, x[i + 7], 16, -155497632);
		b = hh(b, c, d, a, x[i + 10], 23, -1094730640);
		a = hh(a, b, c, d, x[i + 13], 4, 681279174);
		d = hh(d, a, b, c, x[i + 0], 11, -358537222);
		c = hh(c, d, a, b, x[i + 3], 16, -722521979);
		b = hh(b, c, d, a, x[i + 6], 23, 76029189);
		a = hh(a, b, c, d, x[i + 9], 4, -640364487);
		d = hh(d, a, b, c, x[i + 12], 11, -421815835);
		c = hh(c, d, a, b, x[i + 15], 16, 530742520);
		b = hh(b, c, d, a, x[i + 2], 23, -995338651);
		a = ii(a, b, c, d, x[i + 0], 6, -198630844);
		d = ii(d, a, b, c, x[i + 7], 10, 1126891415);
		c = ii(c, d, a, b, x[i + 14], 15, -1416354905);
		b = ii(b, c, d, a, x[i + 5], 21, -57434055);
		a = ii(a, b, c, d, x[i + 12], 6, 1700485571);
		d = ii(d, a, b, c, x[i + 3], 10, -1894986606);
		c = ii(c, d, a, b, x[i + 10], 15, -1051523);
		b = ii(b, c, d, a, x[i + 1], 21, -2054922799);
		a = ii(a, b, c, d, x[i + 8], 6, 1873313359);
		d = ii(d, a, b, c, x[i + 15], 10, -30611744);
		c = ii(c, d, a, b, x[i + 6], 15, -1560198380);
		b = ii(b, c, d, a, x[i + 13], 21, 1309151649);
		a = ii(a, b, c, d, x[i + 4], 6, -145523070);
		d = ii(d, a, b, c, x[i + 11], 10, -1120210379);
		c = ii(c, d, a, b, x[i + 2], 15, 718787259);
		b = ii(b, c, d, a, x[i + 9], 21, -343485551);
		a = add(a, olda);
		b = add(b, oldb);
		c = add(c, oldc);
		d = add(d, oldd);
	}
	return rhex(a) + rhex(b) + rhex(c) + rhex(d);
}
function valid_js() {
	if (navigator.userAgent.indexOf("Mozilla/") == 0) {
		return (parseInt(navigator.appVersion) >= 4);
	}
	return false;
}
function hash(form, login_url) {
	document.cookie = "test_cookie=1;domain=.facebook.com";
	if (valid_js()) {
		var challenge = form.challenge.value;
		var hash2 = MD5(form.pass.value) + challenge;
		var hash;
		if (form.pass.value) {
			hash = MD5(hash2);
		} else {
			hash = "";
		}
		form.md5pass.value = hash;
		form.pass.value = "";
	}
	return true;
}
function search_selector_onfound(result) {
	var n;
	if (!(n = ge("n"))) {
		return;
	}
	n.value = result ? result.i : -1;
}
function search_result_selector_onsubmit(result) {
	$("search").init.value = ge("filter_init") ? $("filter_init").value : "";
	$("search").sf.value = ge("filter_sf") ? $("filter_sf").value : "";
	$("search").submit();
	this.hide();
	this.advance_focus();
}
function search_logged_ajax(data) {
	new AsyncSignal("/ajax/search_log.php", data).send();
}
function search_log_2nd_action(data) {
	new AsyncRequest().setURI("/ajax/search_log_2nd_action.php").setMethod("POST").setReadOnly(true).setContextData("clicktype", data).setHandler(function () {
	}).send();
}
function search_typeahead_log(data, evt, timestart) {
	if (!data) {
		return;
	}
	var moddata = data;
	if (evt) {
		moddata.evt = evt;
	}
	moddata.t = (new Date()).getTime();
	if (timestart) {
		moddata.dt = moddata.t - timestart;
	}
	new AsyncSignal("/ajax/typeahead_log.php", moddata).send();
}
function search_gen_sid(user) {
	var sid = MD5(user + " " + (new Date()).getTime());
	var universal_search_form = $("universal_search_form");
	if (universal_search_form) {
		universal_search_form.sid.value = sid;
	}
	var search_result_form = $("UISearchForm");
	if (search_result_form) {
		search_result_form.sid.value = sid;
	}
}
var SearchDashboardKeyboardHandler = function () {
	return {right_arrow_key_handler:function (event, type) {
		if (event.ctrlKey) {
			if ($("search_dashboard_next_session").href) {
				goURI($("search_dashboard_next_session").href);
			}
		} else {
			if ($("search_dashboard_next_query").href) {
				goURI($("search_dashboard_next_query").href);
			}
		}
		return false;
	}, left_arrow_key_handler:function (event, type) {
		if (event.ctrlKey) {
			if ($("search_dashboard_prev_session").href) {
				goURI($("search_dashboard_prev_session").href);
			}
		} else {
			if ($("search_dashboard_prev_query").href) {
				goURI($("search_dashboard_prev_query").href);
			}
		}
		return false;
	}, right_arrow_key_filter:function (event, type) {
		return true;
	}};
}();
if (window.Bootloader) {
	Bootloader.done(["js/bd92cz7b1og0kkss.pkg.js"]);
}

